<script setup lang='ts'>
import { computed, ref } from 'vue';

const username = ref("张三") // 声明一个变量

const userNameComputed = computed({
    // 完整的写法 
    get() {
        return username.value
    },
    set(value) {
        username.value = value
    }
})
</script>

<template>
    <p>{{ username }}</p>
    <p>
        <input type="text" v-model="username">
    </p>
    <p>{{ userNameComputed }}</p>
    <p>
        <input type="text" v-model="userNameComputed">
    </p>
</template>

<style scoped></style>